Skip to content

fix(caveman-stats): correct Opus output price ($75β†’$25) for 4.5+ era#466

Open
jmmarquez2025 wants to merge 1 commit into
JuliusBrussee:mainfrom
jmmarquez2025:fix/opus-4-output-price
Open

fix(caveman-stats): correct Opus output price ($75β†’$25) for 4.5+ era#466
jmmarquez2025 wants to merge 1 commit into
JuliusBrussee:mainfrom
jmmarquez2025:fix/opus-4-output-price

Conversation

@jmmarquez2025

Copy link
Copy Markdown

Fixes #465.

Problem

src/hooks/caveman-stats.js priceForModel() prefix-matches every claude-opus-4* id to $75/M output β€” the legacy Claude 3 Opus rate. Anthropic's Opus rate card has been $5/M in, $25/M out since Opus 4.5 (4.8 shipped on the same card, 2026-05-28). So /caveman-stats overstates the savings/cost figure ~3Γ— for anyone running a current Opus model β€” increasingly the default.

claude-haiku-4 was also stale ($4 vs Haiku 4.5's $5/M).

Fix

Split the table into legacy vs current Opus, most-specific prefixes first (the loop returns the first match), so retired 4.0/4.1 (incl. dated ids like claude-opus-4-20250514) keep $75 while 4.5–4.8 resolve to $25:

['claude-opus-4-0',    75.00],
['claude-opus-4-1',    75.00],
['claude-opus-4-2025', 75.00],   // dated 4.0 ids
['claude-opus-4',      25.00],   // 4.5–4.8
...
['claude-haiku-4',      5.00],   // Haiku 4.5

This keeps the existing dated-id test (claude-opus-4-20250101 β†’ 75) valid instead of regressing it β€” preferred over a flat constant flip, which is the alternative I floated in #465.

Tests

tests/test_caveman_stats.js updated and green β€” 29/29. Added asserts pinning both eras (claude-opus-4-8 β†’ 25, claude-opus-4-1-20250805 β†’ 75).

Note: npm test (the tests/installer/* suite) shows 4 failing opencode … tests, but they fail identically on a clean main checkout β€” pre-existing and unrelated to this change.

Source: https://platform.claude.com/docs/en/about-claude/pricing

priceForModel prefix-matched every claude-opus-4* id to $75/M output β€”
the legacy Claude 3 Opus rate. Opus 4.5–4.8 is $25/M (rate card held
since 4.5), so /caveman-stats overstated the savings figure ~3x on any
current-Opus session.

Split the price table into legacy (4.0/4.1 + dated ids β†’ $75) and
current (4.5–4.8 β†’ $25) prefixes, most-specific-first so existing
dated-id behavior is preserved. Also corrects Haiku 4.5 to $5/M (was $4).

caveman-stats suite stays green (29/29). The 4 pre-existing opencode
installer failures are unrelated to this change.

Closes JuliusBrussee#465

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

caveman-stats: opus-4 output price hardcoded at $75/M is stale (Opus 4.5–4.8 is $25/M) β†’ savings estimate 3Γ— high

1 participant